import request from '@/utils/request'

// 查询待处理残次品列表
export function listGoods(query) {
  return request({
    url: '/quality-service/quality/badGoods/list',
    method: 'get',
    params: query
  })
}

// 查询待处理残次品详细
export function getGoods(id) {
  return request({
    url: '/quality-service/quality/badGoods/' + id,
    method: 'get'
  })
}

// 新增待处理残次品
export function addGoods(data) {
  return request({
    url: '/quality-service/quality/badGoods',
    method: 'post',
    data: data
  })
}

// 修改待处理残次品
export function updateGoods(data) {
  return request({
    url: '/quality-service/quality/badGoods',
    method: 'put',
    data: data
  })
}

// 删除待处理残次品
export function delGoods(id) {
  return request({
    url: '/quality-service/quality/badGoods/' + id,
    method: 'delete'
  })
}

// 次品合格
export function pass(mesBadGoods) {
  return request({
    url: '/quality-service/quality/badGoods/pass',
    method: 'post',
    data: mesBadGoods
  })
}

//不合格返工
export function fail(mesBadGoods) {
  return request({
    url: '/quality-service/quality/badGoods/fail',
    method: 'post',
    data: mesBadGoods
  })
}

//填写不合格产品报告
export function addReports(data) {
  return request({
    url: '/quality-service/quality/reports',
    method: 'post',
    data: data
  })
}